<?php
/**
 * 后台管理员操作处理代码
 */
// 引入项目初始化文件
require '../include/init.php';
// 获取操作的标识act的值
$act = isset($_GET['act']) ? $_GET['act'] : $_POST['act'];
// 处理非法操作
$action = ['add', 'edit','del'];
if(!in_array($act, $action)){
	msg('非法操作');
}

//订单处理
else if($act == 'edit'){
	extract($_POST);
	$sql ="select *from tr_order where order_id= $id";
	$res= mysql_query($sql);
	$info= mysql_fetch_assoc($res);
	if($info['order_status']==0){
		msg("该订单未结账");
		exit;
	}else{
			
		$sql = "UPDATE  tr_order set order_status=$goods where order_id =$id";
			mysql_query($sql);
		if(mysql_affected_rows()>0){
			msg('发货成功','order_list.php');
		}else{
			msg('发货失败','order_list.php');
		}
	}
}
//删除订单
else if($act == 'del'){
	$oid = $_GET['id'];
	$sql = "DELETE FROM tr_order where order_id = $oid";
	mysql_query($sql);
	if(mysql_affected_rows()>0){
		msg("删除成功","order_list.php");
	}else{
		msg("删除失败","order_list.php");
}	
}

?>